set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR aarch64)# arm/aarch64

set(CMAKE_C_COMPILER
    "/opt/gcc/gcc-linaro-7.5.0/bin/aarch64-linux-gnu-gcc"
)
set(CMAKE_CXX_COMPILER
    "/opt/gcc/gcc-linaro-7.5.0/bin/aarch64-linux-gnu-g++"
)
# 将/opt/gcc/arm32v7/third-party插入到CMAKE_FIND_ROOT_PATH的索引0开头处
list(INSERT CMAKE_FIND_ROOT_PATH 0 /opt/gcc/gcc-linaro-7.5.0/third-party)
# 不搜索主机环境中的程序
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# 仅搜索根路径下的头文件和库文件
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

set(CMAKE_C_FLAGS "-march=armv8-a")
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}")
set(CMAKE_ASM_FLAGS "${CMAKE_C_FLAGS} -x assembler-with-cpp")

# cache flags
set(CMAKE_C_FLAGS
    "${CMAKE_C_FLAGS}"
    CACHE STRING "c flags")
set(CMAKE_CXX_FLAGS
    "${CMAKE_CXX_FLAGS}"
    CACHE STRING "c++ flags")